#!/usr/bin/env python
#coding=utf-8 

'''
class RoundFloatManual(object):
	def __init(self, val):
		assert isinstance(val, float), \
			"Value must be a float"
		self.value = round(val, 2)

rfm = RoundFloatManual(42)
Traceback (most recent call last):
  File "./basis03.py", line 26, in <module>
    rfm = RoundFloatManual(42)
  File "./basis03.py", line 21, in __init__
    "Value must be a float"
AssertionError: Value must be a float
'''

class RoundFloatManual(object):
	def __init__(self, val):
		assert isinstance(val, float), \
			"Value must be a float"
		self.value = round(val, 2)
	def __str__(self):
		# return str(self.value)
		return '%.2f' % self.value
	__repr__ = __str__
rfm = RoundFloatManual(42.0)
print rfm

class Time60(object):
	def __init__(self, hr, min):
		self.hr = hr
		self.min = min
	def __str__(self):
		return '%d : %d' % (self.hr, self.min)
	def __add__(self, other):
		return self.__class__(self.hr + other.hr, self.min+other.min)
	def __iadd__(self, other):
		self.hr += other.hr
		self.min += other.min
		return self

	__repr__ = __str__
mon = Time60(10, 30)
tue = Time60(11, 15)
print mon, tue
print mon + tue
mon+=tue
print mon